package com.lvcoding.codegen.domain;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * @Description 数据返回类
 * @Date 2020-12-30 1:24 下午
 * @Author wuyanshen
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class Res {

    private Integer code;
    private String msg;
    private Object data;

    public static Res success(String msg, Object data) {
        return new Res(200, msg, data);
    }

    public static Res success(String msg) {
        return new Res(200, msg, null);
    }

    public static Res fail(String msg, Object data) {
        return new Res(500, msg, data);
    }

    public static Res fail(String msg) {
        return new Res(500, msg, null);
    }

}
